//@ : src
import http from "@/utils/http";

//todo 分别导出接口
//todo 1. 设置验证码类型
export interface CaptchaData {
    image: string;
    key: string;
}

//todo 发送验证码
export let getCaptchaData = () => {
    return http.get<CaptchaData>('/admin/login/captcha')
}
//------------------------------------------------------------------
//todo 2. 设置登录功能参数类型
export interface LoginParam {
    username: string
    password: string
    captchaKey: string
    captchaCode: string
}

//todo 验证登录功能
export let doLogin = (loginParam: LoginParam) => {
    return http.post<string>('/admin/login', loginParam)
}
//------------------------------------------------------------------
//todo 3. 设置获取的用户信息类型
export interface UserInfoData {
    name: string,
    avatarUrl: string
}

//todo 获取登录的用户信息
export let getUserInfoData = () => {
    return http.get<UserInfoData>('/admin/info')
}


